home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / AppleScript / Additions / GTQ Library 1.2 / Sample Scripts / SMD v1.2 < prev    next >
Encoding:
Text File  |  1994-05-03  |  1.5 KB  |  31 lines  |  [TEXT/ToyS]

  1. on run
  2.     global nodeList, newList, useSpeech, pollInterval
  3.     display dialog "How long (in seconds) between checks?" default answer "60"
  4.     set pollInterval to the text returned of the result
  5.     display dialog "Use visual alerts, spoken alerts, or both?" buttons {"Visual", "Spoken", "Both"} default button "Both"
  6.     set useSpeech to the button returned of the result
  7.     if useSpeech is "Spoken" or useSpeech is "Both" then speak "Initializing."
  8.     list nodes type "AFPServer"
  9.     set nodeList to the result
  10.     if useSpeech is "Spoken" or useSpeech is "Both" then speak "Ready."
  11. end run
  12.  
  13. on idle
  14.     global nodeList, newList, useSpeech, pollInterval
  15.     set AppleScript's text item delimiters to {":"}
  16.     set newList to (list nodes type "AFPServer")
  17.     repeat with serverName in newList
  18.         if nodeList does not contain serverName then
  19.             if useSpeech is "Spoken" or useSpeech is "Both" then speak (text item 1 of serverName) & " just came up."
  20.             if useSpeech is "Visual" or useSpeech is "Both" then request attention message (text item 1 of serverName) & " just came up." timeout 15
  21.         end if
  22.     end repeat
  23.     repeat with serverName in nodeList
  24.         if newList does not contain serverName then
  25.             if useSpeech is "Spoken" or useSpeech is "Both" then speak (text item 1 of serverName) & " just went down."
  26.             if useSpeech is "Visual" or useSpeech is "Both" then request attention message (text item 1 of serverName) & " just went down." timeout 15
  27.         end if
  28.     end repeat
  29.     set nodeList to newList
  30.     return pollInterval
  31. end idle